package fun.stgoder.dev.listener.common;

import cn.hutool.setting.Setting;

public class SettingUtil {
    private static Setting setting;

    static {
        String osName = System.getProperty("os.name");
        System.out.println(osName);
        if (osName.toLowerCase().contains("windows")) {
            setting = new Setting("app.setting.win");
        } else {
            setting = new Setting("app.setting");
        }
    }

    public static String getString(String key, String defaultVal) {
        return setting.getOrDefault(key, defaultVal);
    }

    public static int getInt(String key, int defaultVal) {
        return setting.getInt(key, defaultVal);
    }

    public static boolean getBoolean(String key, boolean defaultVal) {
        return setting.getBool(key, defaultVal);
    }
}
